package com.api.shopapi.service.impl;


import com.api.shopapi.entity.DiseaseType;
import com.api.shopapi.entity.dto.DeviceTogWatchDTO;
import com.api.shopapi.mapper.DeviceYjgatewayMapper;
import com.api.shopapi.mapper.DiseaseTypeMapper;
import com.api.shopapi.service.DiseaseTypeService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("DiseaseTypeServiceImplOne")
public class DiseaseTypeServiceImpl implements DiseaseTypeService {


    @Autowired
    private DiseaseTypeMapper diseaseTypeMapper;

    @Override
    public
    int insert(DiseaseType diseaseType){
        return diseaseTypeMapper.insert(diseaseType);
    }

    @Override
    public
    int update(DiseaseType diseaseType){
        return diseaseTypeMapper.update(diseaseType);
    }

    @Override
    public
    DiseaseType getByDiseaseTypeCode(String diseaseTypeCode){
        return diseaseTypeMapper.getByDiseaseTypeCode(diseaseTypeCode);
    }

    @Override
    public
    DiseaseType getByDiseaseTypeName(String diseaseTypeName){
        return diseaseTypeMapper.getByDiseaseTypeName(diseaseTypeName);
    }

    @Override
    public
    List<DiseaseType> listByInsCode(String institutionCode){
        return diseaseTypeMapper.listByInsCode(institutionCode);
    }



    @Override
    public
    PageInfo<DiseaseType> pageByInsCode(int pageIndex, int pageSize, String institutionCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<DiseaseType> deviceTogWatchDTOList = diseaseTypeMapper.listByInsCode(institutionCode);
        return new PageInfo<>(deviceTogWatchDTOList);
    }

    @Override
    public
    PageInfo<DiseaseType> pageByGovCode(int pageIndex, int pageSize, String govCode){
        PageHelper.startPage(pageIndex,pageSize);
        List<DiseaseType> deviceTogWatchDTOList = diseaseTypeMapper.listByGovCode(govCode);
        return new PageInfo<>(deviceTogWatchDTOList);
    }

}
